//
//  HomeBtnCell.m
//  Ginix
//
//  Created by 冯志强 on 2025/2/23.
//

#import "HomeBtnCell.h"

@interface HomeBtnCell()
@property (nonatomic,strong) UIButton    * packBtn;
@property (nonatomic,strong) UIButton    * inviteBtn;
@end

@implementation HomeBtnCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setSubViewLayout];
    }
    return self;
}

-(void)setSubViewLayout{
    
    self.backgroundColor = UIColor.clearColor;
    self.contentView.backgroundColor = UIColor.clearColor;
    
    [self.contentView addSubview:self.packBtn];
    [_packBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(20 * FMScaleX);
        make.size.mas_offset(CGSizeMake(160 * FMScaleX, 70 * FMScaleX));
        make.centerY.equalTo(@0);
    }];
    [self.contentView addSubview:self.inviteBtn];
    [_inviteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_offset(-20 * FMScaleX);
        make.size.mas_offset(CGSizeMake(160 * FMScaleX, 70 * FMScaleX));
        make.centerY.equalTo(@0);
    }];
    
}

-(void)packBtnAction{
    
    NSLog(@"222");
}

-(void)inviteBtnAction{
    
    id vc = [[NSClassFromString(@"HealthGftKitVC") alloc]init];
    [[UIViewController findNavigationController] pushViewController:vc animated:YES];
    
}

-(UIButton *)packBtn{
    
    if (!_packBtn) {
        _packBtn = [[UIButton alloc]init];
        [_packBtn setBackgroundImage:[UIImage imageNamed:@"Me_pack_icon"] forState:UIControlStateNormal];
        [_packBtn addTarget:self action:@selector(packBtnAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _packBtn;
}
-(UIButton *)inviteBtn{
    
    if (!_inviteBtn) {
        _inviteBtn = [[UIButton alloc]init];
        [_inviteBtn setBackgroundImage:[UIImage imageNamed:@"Me_invite_icon"] forState:UIControlStateNormal];
        [_inviteBtn addTarget:self action:@selector(inviteBtnAction) forControlEvents:UIControlEventTouchUpInside];

    }
    return _inviteBtn;
}
@end
